<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" th:href="@{/css/font.css}">
    <link rel="stylesheet" th:href="@{/css/xadmin.css}">
    <script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body style="background-color:#FFFAE3">
<div id="div1">
    <div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">演示</a>
            <a>
              <cite>导航元素</cite></a>
          </span>
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
    </div>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card" style="background-color:#FFFAE3" >
                    <p style="color: #0070C0;text-align: center;font-size: large;font-weight: bold;">询价书列表</p><br>
                    <div class="layui-card-body ">
                        <form class="layui-form layui-col-space5" style="text-align: center">
                            <div class="layui-inline">
                                询价书名称：
                                <div class="layui-input-inline">
                                    <input type="text" name="enquireName" id="enquireName" autocomplete="off"  placeholder="询价书名称" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                状态：
                                <div class="layui-input-inline">
                                    <select name="status" id="status">
                                        <option value="">全部</option>
                                        <option value="未发布">未发布</option>
                                        <option value="未揭示">未揭示</option>
                                        <option value="已截至">已截至</option>
                                        <option value="已揭示">已揭示</option>
                                    </select>
                                </div>


                            </div>
                            <div class="layui-inline layui-show-xs-block">
                                <!--<button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>-->
                                <button class="layui-btn" data-type="reload" id="search">查询</button>
                            </div>
                        </form>
                    </div>
                    <div class="layui-card-body layui-table-body layui-table-main">
                        <table class="layui-table layui-form" id="test" lay-filter="test"></table>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
<div id="div2">
    <div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">演示</a>
            <a>
              <cite>导航元素</cite></a>
          </span>
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
    </div>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body layui-table-body layui-table-main" style="background-color:#FFFAE3">
                        <!--<table class="layui-table layui-form" id="test"></table>-->
                        <TABLE class="layui-table layui-form" style="LINE-HEIGHT: 30px" cellSpacing=1 cellPadding=0 width="100%"
                               bgColor=#336699 borderColorLight=#006699 border=0>
                            <TBODY>
                            <TR>
                                <TD style="background-color:#FFFAE3">
                                    <TABLE class="layui-table layui-form" cellSpacing=1 cellPadding=3 width="100%" border=0 style="background-color: #FFFAE3">
                                        <TBODY style="background-color: #FFFAE3">
                                        <TR style="background-color: #FFFAE3">
                                            <TD align=middle width="100%" bgColor=#ffffff colSpan=20
                                                height=22 style="background-color: #FFFAE3">
                                                <H2 style="color:#0070c0 "><B>修改询价书</B> <A
                                                        onclick="window.open('../help/Help.asp?Value=询价书明细信息','child','status=NO,scrollbars=yes,toolbar=no,menubar=no,location=no,left=200,top=100,width=700,height=400')"
                                                        href="javascript:void(null)"></A>
                                                </H2></TD></TR>
                                        <TR class=t1>
                                            <TD noWrap width="20%" hidden>询价书序号</TD>
                                            <TD class=t2 noWrap id="id" hidden></TD>
                                            <TD noWrap width="20%">询价书编号</TD>
                                            <TD class=t2 noWrap id="enquireNum"></TD>
                                            <TD noWrap width="20%">询价书名称</TD>
                                            <TD class=t2 noWrap><input type="text" id="enquireName2" name="enquireName2" style="background-color: #FFFAE3"></TD></TR>
                                        <TR class=t1>
                                            <TD noWrap width="20%">单位</TD>
                                            <TD class=t2 noWrap id="company"></TD>
                                            <TD noWrap width="20%">联系人</TD>
                                            <TD class=t2 noWrap><input type="text" id="linkman" name="linkman" style="background-color: #FFFAE3"></TD></TR>
                                        <TR class=t1>
                                            <TD noWrap width="20%">联系地址</TD>
                                            <TD class=t2 noWrap><input type="text" id="address" name="address"style="background-color: #FFFAE3" /></TD>
                                            <TD noWrap width="20%">联系电话</TD>
                                            <TD class=t2 noWrap><input type="text" id="phone" name="phone" style="background-color: #FFFAE3"/></TD></TR>
                                        <TR class=t1>
                                            <TD noWrap width="20%">联系传真</TD>
                                            <TD class=t2 noWrap><input type="text" id="fax" name="fax" style="background-color: #FFFAE3"/></TD>
                                            <TD noWrap width="20%">邮编</TD>
                                            <TD class=t2 noWrap><input type="text" id="zip" name="zip" style="background-color: #FFFAE3"/></TD></TR>
                                        <TR class=t1>
                                            <TD noWrap width="20%">Email</TD>
                                            <TD class=t2 noWrap><input type="text" id="email" name="email" style="background-color: #FFFAE3"/></TD>
                                            <TD noWrap width="20%">报价截止时间</TD>
                                            <TD class=t2 noWrap><input type="date" id="endDate" name="endDate" style="background-color: #FFFAE3"/>
                                            </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
                        <TABLE class="layui-table layui-form" cellSpacing=1 cellPadding=0 width="100%" bgColor=#ffffff
                               borderColorLight=#ffffff border=0>
                            <TBODY>
                            <TR>
                                <TD style="background-color:#FFFAE3">
                                    <TABLE class="layui-table layui-form" cellSpacing=1 cellPadding=3 width="100%"
                                           border=0><B>我公司欲采购下述物资，如贵单位有兴趣，可参与网上报价。详细物资情况如下：</B>
                                        <TBODY></TBODY></TABLE></TD></TR></TBODY></TABLE>
                        </table></td></tr></table>

                        <TABLE class="layui-table layui-form" style="LINE-HEIGHT: 30px" cellSpacing=1 cellPadding=0   id="tableEnq"  width="100%"  bgColor=#336699 borderColorLight=#006699 border=0>

                        </table>

                        <TABLE class="layui-table layui-form" style="LINE-HEIGHT: 30px" cellSpacing=1 cellPadding=0     width="100%"  bgColor=#336699 borderColorLight=#006699 border=0>
                            <tr>
                                <td style="background-color:#FFFAE3">
                                    <table class="layui-table layui-form" cellpadding="3" cellspacing="1" border="0" width="100%">


                                        <tr class="t2" style="background-color: #FFFAE3">
                                            <td nowrap>询价说明</td>
                                            <td colspan="3" style="width:100%"><textarea name="textarea" id="remark" rows="4" style="width:100%;background-color: #FFFAE3"></textarea></td>
                                        </tr>
                                    </table></td></tr></table>

                        </form>
                        <script Language="JavaScript" src="js/pub_Calendar.js"></script>
                        <script language="javascript">
                            function QuotePrint(p_QuoteNo)
                            {
                                window.open("Quote_Print.ASP?QuoteNo="+p_QuoteNo,"","toolbar=0,resizable=yes,location=0,status=0,menubar=1,scrollbars=1,width=800,height=600,left=0,top=0");
                            }
                        </script>
                        <TABLE class="layui-table layui-form" style="LINE-HEIGHT: 30px;background-color: #FFFAE3" cellSpacing=1 cellPadding=0 width="100%"
                               bgColor=#336699 borderColorLight=#006699 border=0>
                            <TBODY>
                            <TR>
                                <TD>
                                    <TABLE class="layui-table layui-form"  cellSpacing=1 cellPadding=3 width="100%" border=0>
                                        <TBODY>
                                        </TBODY></TABLE></TD></TR></TBODY></TABLE><BR></FORM>
                        <P align=right><BR><B id="gsi"></B>
                        <CENTER><BR>
                            <INPUT type="button" value="确定" onClick="updateEnq()" name="button2">
                            <INPUT onclick="location.href='/queryandqueto/ask1.html'" type=button value=返回 name=button1>
                        </CENTER>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
<div id="div3">
    <div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">演示</a>
            <a>
              <cite>导航元素</cite></a>
          </span>
        <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
            <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
    </div>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body layui-table-body layui-table-main">
                        <!--<table class="layui-table layui-form" id="test"></table>-->
                        <TABLE class="layui-table layui-form" style="LINE-HEIGHT: 30px" cellSpacing=1 cellPadding=0 width="100%"
                               bgColor=#336699 borderColorLight=#006699 border=0>
                            <TBODY>
                            <TR>
                                <TD>
                                    <TABLE cellSpacing=1 cellPadding=3 width="100%" border=0>
                                        <TBODY>
                                        <TR bgColor=#ffffff>
                                            <TD align=middle width="100%" bgColor=#ffffff colSpan=20
                                                height=22>
                                                <H2 style="color:#0070c0 "><B>询价书明细</B> <A
                                                        onclick="window.open('../help/Help.asp?Value=询价书明细信息','child','status=NO,scrollbars=yes,toolbar=no,menubar=no,location=no,left=200,top=100,width=700,height=400')"
                                                        href="javascript:void(null)"></A>
                                                </H2></TD></TR>
                                        <TR class=t1>
                                            <TD noWrap width="20%" hidden>询价书序号</TD>
                                            <TD class=t2 noWrap id="id2" hidden></TD>
                                            <TD noWrap width="20%">询价书编号</TD>
                                            <TD class=t2 noWrap id="enquireNum2"></TD>
                                            <TD noWrap width="20%">询价书名称</TD>
                                            <TD class=t2 noWrap id="enquireName3"></TD></TR>
                                        <TR class=t1>
                                            <TD noWrap width="20%">单位</TD>
                                            <TD class=t2 noWrap id="company2"></TD>
                                            <TD noWrap width="20%">联系人</TD>
                                            <TD class=t2 noWrap id="linkman2"></TD></TR>
                                        <TR class=t1>
                                            <TD noWrap width="20%">联系地址</TD>
                                            <TD class=t2 noWrap id="address2"></TD>
                                            <TD noWrap width="20%">联系电话</TD>
                                            <TD class=t2 noWrap id="phone2"></TD></TR>
                                        <TR class=t1>
                                            <TD noWrap width="20%">联系传真</TD>
                                            <TD class=t2 noWrap id="fax2"></TD>
                                            <TD noWrap width="20%">邮编</TD>
                                            <TD class=t2 noWrap id="zip2"></TD></TR>
                                        <TR class=t1>
                                            <TD noWrap width="20%">Email</TD>
                                            <TD class=t2 noWrap id="email2"></TD>
                                            <TD noWrap width="20%">报价截止时间</TD>
                                            <TD class=t2 noWrap id="endDate2">
                                            </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
                        <TABLE class="layui-table layui-form" cellSpacing=1 cellPadding=0 width="100%" bgColor=#ffffff
                               borderColorLight=#ffffff border=0>
                            <TBODY>
                            <TR>
                                <TD >
                                    <TABLE cellSpacing=1 cellPadding=3 width="100%"
                                           border=0><B>我公司欲采购下述物资，如贵单位有兴趣，可参与网上报价。详细物资情况如下：</B>
                                        <TBODY></TBODY></TABLE></TD></TR></TBODY></TABLE>
                        </table></td></tr></table>

                        <TABLE class="layui-table layui-form" style="LINE-HEIGHT: 30px" cellSpacing=1 cellPadding=0   id="tableEnq2"   width="100%"  bgColor=#336699 borderColorLight=#006699 border=0>

                        </table>

                        <TABLE class="layui-table layui-form" style="LINE-HEIGHT: 30px" cellSpacing=1 cellPadding=0     width="100%"  bgColor=#336699 borderColorLight=#006699 border=0>
                            <tr>
                                <td>
                                    <table cellpadding="3" cellspacing="1" border="0" width="100%">

                                        <tr class="t2">
                                            <td nowrap>报价有效期</td>
                                            <td><span id="endDate3" style="width:100%"></span></td>
                                        </tr>
                                        <tr class="t2">
                                            <td nowrap>询价说明</td>
                                            <td style="width:100%" id="remark2"></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>

                        </form>
                        <script Language="JavaScript" src="js/pub_Calendar.js"></script>
                        <script language="javascript">
                            function QuotePrint(p_QuoteNo)
                            {
                                window.open("Quote_Print.ASP?QuoteNo="+p_QuoteNo,"","toolbar=0,resizable=yes,location=0,status=0,menubar=1,scrollbars=1,width=800,height=600,left=0,top=0");
                            }
                        </script>
                        <TABLE class="layui-table layui-form" style="LINE-HEIGHT: 30px" cellSpacing=1 cellPadding=0 width="100%"
                               bgColor=#336699 borderColorLight=#006699 border=0>
                            <TBODY>
                            <TR>
                                <TD>
                                    <TABLE cellSpacing=1 cellPadding=3 width="100%" border=0>
                                        <TBODY>
                                        </TBODY></TABLE></TD></TR></TBODY></TABLE><BR></FORM>

                        <CENTER>
                            <INPUT id=button2 onclick="location.href='/queryandqueto/ask1.html'" type=button value=返回 name=button1>
                        </CENTER>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
<div id="div4">
    <div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">演示</a>
            <a>
              <cite>导航元素</cite></a>
          </span>
        <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
            <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
    </div>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body layui-table-body layui-table-main">
                        <TABLE class="layui-table layui-form" style="LINE-HEIGHT: 30px" cellSpacing=1 cellPadding=0     width="100%"  bgColor=#336699 borderColorLight=#006699 border=0>
                            <tr>
                                <td>
                                    <table class="layui-table layui-form" cellpadding="3" cellspacing="1" border="0" width="100%">
                                        <tr bgcolor="#ffffff">
                                            <td width="100%" colspan="6" bgcolor="#ffffff" align=center height=30><h2 style="color: #0070C0" ><b>查看供应商报价明细</b></h2></td>
                                        </tr>
                                        <TR class=t1>
                                            <TD noWrap width="20%" hidden>询价书序号</TD>
                                            <TD class=t2 noWrap id="id3" hidden></TD>
                                            <TD noWrap width="20%">报价单位</TD>
                                            <TD class=t2 noWrap id="companyB"></TD>
                                            <TD noWrap width="20%">询价单位</TD>
                                            <TD class=t2 noWrap id="companyX"></TD></TR>
                                        <TR class=t1>
                                            <TD noWrap width="20%">地址</TD>
                                            <TD class=t2 noWrap id="addressB"></TD>
                                            <TD noWrap width="20%">地址</TD>
                                            <TD class=t2 noWrap id="addressX"></TD></TR>
                                        <TR class=t1>
                                            <TD noWrap width="20%">联系人</TD>
                                            <TD class=t2 noWrap id="contact"></TD>
                                            <TD noWrap width="20%">联系人</TD>
                                            <TD class=t2 noWrap id="linkmanX"></TD></TR>
                                        <TR class=t1>
                                            <TD noWrap width="20%">电话</TD>
                                            <TD class=t2 noWrap id="phoneB"></TD>
                                            <TD noWrap width="20%">电话</TD>
                                            <TD class=t2 noWrap id="phoneX"></TD></TR>
                                        <TR class=t1>
                                            <TD noWrap width="20%">传真</TD>
                                            <TD class=t2 noWrap id="faxB"></TD>
                                            <TD noWrap width="20%">传真</TD>
                                            <TD class=t2 noWrap id="faxX"></TD>
                                        </TR>
                                        <TR class=t1>
                                            <TD noWrap width="20%">E-mail</TD>
                                            <TD class=t2 noWrap id="emailB"></TD>
                                            <TD noWrap width="20%">E-mail</TD>
                                            <TD class=t2 noWrap id="emailX">
                                            </TD>
                                        </TR>
                                        <TR class=t1>
                                            <TD noWrap width="20%">报价时间</TD>
                                            <TD class=t2 noWrap id="createDate"></TD>
                                            <TD noWrap width="20%">询价时间</TD>
                                            <TD class=t2 noWrap id="endDateX">
                                            </TD>
                                        </TR>
                                        <tr bgcolor="#ffffff">

                                        </tr>
                                    </table></td></tr></table>
                        <TABLE cellSpacing=1 cellPadding=3 width="100%"
                               border=0><B>供应商对本公司的<span style="color:#9933FF ;text-align: center" id="bianhao"></span>询价书具体报价情况如下：</B>
                            <TBODY></TBODY></TABLE>
                        <TABLE class="layui-table layui-form" style="LINE-HEIGHT: 30px" cellSpacing=1 cellPadding=0  id="tableSup"   width="100%"  bgColor=#336699 borderColorLight=#006699 border=0>

                        </table>

                        <TABLE class="layui-table layui-form" style="LINE-HEIGHT: 30px" cellSpacing=1 cellPadding=0     width="100%"  bgColor=#336699 borderColorLight=#006699 border=0>
                            <tr>
                                <td>
                                    <table cellpadding="3" cellspacing="1" border="0" width="100%">

                                        <tr class="t2">
                                            <td nowrap>数量合计</td>
                                            <td>1</td>
                                            <td nowrap>总金额(元/含税)</td>
                                            <td id="sum"></td>
                                        </tr>
                                        <tr class="t2">
                                            <td nowrap>报价书标题</td>
                                            <td id="title"></td>
                                            <td nowrap>报价有效期</td>
                                            <td id="createDate2"></td>
                                        </tr>
                                        <tr class="t2">
                                            <td nowrap>报价说明</td>
                                            <td style="width:100%" id="remarkX"></td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                        <p Align="center">
                            <input onClick="$('#div4').hide();$('#div3').show();" type="button" name="back" value="返回">
                        </p>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script id="button" type="text/html">
    <a class="layui-btn layui-btn-xs" lay-event="updateE">修改询价</a>
    <a class="layui-btn layui-btn-xs" lay-event="del">删除询价</a>
</script>
<script>
    layui.use('table', function(){
        $("#div2").hide();
        $("#div3").hide();
        $("#div4").hide();
        var table = layui.table;
        table.render({
            elem: '#test'  //html中渲染table的id
            , url: '/Enquire/all'   //后台获取数据集合的地址
            , cellMinWidth: 80
            , page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
                layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
                //,curr: 5 //设定初始在第 5 页
                , groups: 1 //只显示 1 个连续页码
                , first: false//不显示首页
                , last: false //不显示尾页

            }, cols: [
                [
                    //表单显示的title以及返回的需要显示的数据，field值与获取集合中的类的字段名一致。
                    {field: 'id', title: '序号', align: 'center',width:80},
                    {field: 'enquireName', title: '询价书标题', toolbar: '#link', align: 'center',width: 130},
                    {field: 'startDate', title: '询价提交时间', align: 'center'},
                    {field: 'endDate', title: '询价截止时间', align: 'center'},
                    {field: 'status', title: '询价书状态', align: 'center'},
                    {title: '操作', toolbar: "#button",align:'center', width:190}
                ]
            ],id:'tableAll'
        });
        /*table.render({
            elem: '#supplier',
            url: '/supplier/findAll',
            cellMinWidth: 80,
            cols: [
                [
                    //表单显示的title以及返回的需要显示的数据，field值与获取集合中的类的字段名一致。
                    {field: 'id', title: '序号', align: 'center', width:200},
                    {field: 'company', title: '供应商名称', toolbar: '#link2', align: 'center', width:200},
                    {field: 'regFund', title: '总额', align: 'center', width:200},
                    {field: 'address', title: '地址', hide:'true' ,align: 'center', width:200},
                    {field: 'contact', title: '联系人', hide:'true', align: 'center', width:200},
                    {field: 'phone', title: '电话', hide:'true', align: 'center', width:200},
                    {field: 'fax', title: '传真', hide:'true', align: 'center', width:200},
                    {field: 'email', title: 'email', hide:'true', align: 'center', width:200},
                    {field: 'createDate', title: '报价时间', hide:'true', align: 'center', width:200},
                    {field: 'endDate', title: '截止时间', align: 'center', width:200}
                ]
            ]
        });
        table.on('tool(supplier)',function (obj) {
            let data = obj.data;
            let id = data["id"];
            let address = data["address"];
            let fax = data["fax"];
            let regFund = data["regFund"];
            let phone = data["phone"];
            let company = data["company"];
            let contact = data["contact"];
            let email = data["email"];
            let createDate = data["createDate"];
            if(obj.event === "check2"){
                $("#div1").hide();
                $("#div2").hide();
                $("#div3").hide();
                $("#div4").show();
                var enquireNum = $("#enquireNum2").html();
                $.ajax({
                    url: "/Enquire/findById",
                    data:{
                        "id":id,
                        "enquireNum":enquireNum
                    },
                    type: "POST",
                    success: function (result) {
                        $("#id3").html(result.id);
                        var companyX = $("#company2").html();
                        $("#companyB").html(company)
                        $("#companyX").html(companyX);
                        $("#addressB").html(address)
                        var addressX = $("#address2").html();
                        $("#addressX").html(addressX);
                        $("#contact").html(contact);
                        var linkmanX = $("#linkman2").html();
                        $("#linkmanX").html(linkmanX);
                        $("#phoneB").html(phone);
                        var phoneX = $("#phone2").html();
                        $("#phoneX").html(phoneX);
                        $("#faxB").html(fax);
                        var faxX = $("#fax2").html();
                        $("#faxX").html(faxX);
                        $("#emailB").html(email);
                        var emailX = $("#email2").html();
                        $("#emailX").html(emailX);
                        $("#createDate").html(createDate);
                        var endDateX = $("#endDate3").html();
                        $("#endDateX").html(endDateX);
                        var name = $("#enquireName3").html();
                        $("#bianhao").html(name);

                        $("#sum").html(regFund);
                        $("#title").html("对"+name+"的报价");
                        $("#createDate2").html(createDate)
                        var remarkX = $("#remark2").html();
                        $("#remarkX").html(remarkX);

                        var orders=result.stock.orders;
                        for (let i = 0; i < orders.length; i++) {
                            $("#tableSup").append(
                                "<tr>\n" +
                                "                                <td>\n" +
                                "                                    <table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\" id=\"datatable\">\n" +
                                "\n" +
                                "                                        <tr>\n" +
                                "                                            <td colspan=6 align=\"middle\" bgcolor=\"#99ccff\"><B>需求计划"+orders[i].id+"</td>\n" +
                                "                                        </tr>\n" +
                                "                                        <tr class=t2>\n" +
                                "                                            <td >物资编码</td>\n" +
                                "                                            <td >"+orders[i].materialCode+"<br></td>\n" +
                                "                                            <td >物资名称</td>\n" +
                                "                                            <td >"+orders[i].materialName+"<br></td>\n" +
                                "                                            <td ></td>\n" +
                                "                                            <td ></td>\n" +
                                "                                        </tr>\n" +
                                "                                        <tr class=t2>\n" +
                                "                                            <td >计量单位</td>\n" +
                                "                                            <td >"+orders[i].measureUnit+"<br></td>\n" +
                                "                                            <td ></td>\n" +
                                "                                            <td ></td>\n" +
                                "                                            <td ></td>\n" +
                                "                                            <td ></td>\n" +
                                "                                        </tr>\n" +
                                "\n" +
                                "                                        <tr bgcolor=\"#FFFFFF\">\n" +
                                "                                            <td nowrap >单价(元/含税)</td>\n" +
                                "                                            <td nowrap >"+orders[i].unitPrice+"</td>\n" +
                                "                                            <td nowrap >数量</td>\n" +
                                "                                            <td nowrap >"+orders[i].amount+"</td>\n" +
                                "                                            <td nowrap >总价(元/含税)</td>\n" +
                                "                                            <td nowrap >"+(orders[i].unitPrice*orders[i].amount)+"</td>\n" +
                                "                                        </tr>\n" +
                                "\n" +
                                "                                        <tr bgcolor=\"#FFFFFF\">\n" +
                                "                                            <td nowrap >报价开始时间</td>\n" +
                                "                                            <td nowrap >"+orders[i].startDate+"</td>\n" +
                                "                                            </td>\n" +
                                "                                            <td nowrap >报价截止时间</td>\n" +
                                "                                            <td nowrap >"+orders[i].endDate+"</td>\n" +
                                "                                            <td nowrap ></td>\n" +
                                "                                            <td nowrap ></td>\n" +
                                "                                            </td>\n" +
                                "                                        </tr>\n" +
                                "\n" +
                                "                                    </table></td></tr>"
                            );
                        }
                    }
                });
            }
        })*/

        table.on('tool(test)',function (obj) {
            let data = obj.data;
            let id = data["id"];
            let enquireNum = data["enquireNum"];
            if(obj.event === "del"){
                layer.confirm('确定要删除吗',function (index) {
                    $.ajax({
                        url:"/Enquire/del",
                        data:{"id":id},
                        type:"post",
                        success:function (result) {
                            if(result>0){
                                alert("删除成功")
                                location.href="/queryandqueto/ask1.html";
                            }
                        },
                        async: false
                    })
                    layer.close(index);
                })

            }else if(obj.event === "updateE"){
                $("#div1").hide();
                $("#div2").show();
                let status = data["status"];
                if(status=="未发布" || status==null){
                    $.ajax({
                        url: "/Enquire/findById",
                        data:{
                            "id":id,
                            "enquireNum":enquireNum
                        },
                        type: "POST",
                        success: function (result) {
                            $("#id").html(result.id);
                            $("#company").html("长沙北大青鸟有限公司");
                            $("#enquireNum").html(result.enquireNum);
                            $("#enquireName2").val(result.enquireName);
                            $("#linkman").val(result.linkman);
                            $("#address").val(result.address);
                            $("#phone").val(result.phone);
                            $("#fax").val(result.fax);
                            $("#zip").val(result.zip);
                            $("#email").val(result.email);
                            $("#endDate").val(result.endDate);
                            $("#remark").val(result.remark);
                            $("#gsi").html("长沙北大青鸟有限公司");
                            var orders=result.stock.orders;
                            for (let i = 0; i < orders.length; i++) {
                                $("#tableEnq").append(
                                    "<tr>\n" +
                                    "                                <td>\n" +
                                    "                                    <table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\" id=\"datatable\">\n" +
                                    "\n" +
                                    "                                        <tr>\n" +
                                    "                                            <td colspan=6 align=\"middle\" bgcolor=\"#99ccff\"><B>需求计划"+orders[i].id+"</td>\n" +
                                    "                                        </tr>\n" +
                                    "                                        <tr class=t2>\n" +
                                    "                                            <td >物资编码</td>\n" +
                                    "                                            <td >"+orders[i].materialCode+"<br></td>\n" +
                                    "                                            <td >物资名称</td>\n" +
                                    "                                            <td >"+orders[i].materialName+"<br></td>\n" +
                                    "                                            <td ></td>\n" +
                                    "                                            <td ></td>\n" +
                                    "                                        </tr>\n" +
                                    "                                        <tr class=t2>\n" +
                                    "                                            <td >计量单位</td>\n" +
                                    "                                            <td >"+orders[i].measureUnit+"<br></td>\n" +
                                    "                                            <td ></td>\n" +
                                    "                                            <td ></td>\n" +
                                    "                                            <td ></td>\n" +
                                    "                                            <td ></td>\n" +
                                    "                                        </tr>\n" +
                                    "\n" +
                                    "                                        <tr bgcolor=\"#FFFFFF\">\n" +
                                    "                                            <td nowrap >单价(元/含税)</td>\n" +
                                    "                                            <td nowrap ><input type='text' name='' value="+orders[i].unitPrice+" /></td>\n" +
                                    "                                            <td nowrap >数量</td>\n" +
                                    "                                            <td nowrap ><input type='text' name='' value="+orders[i].amount+" /></td>\n" +
                                    "                                            <td nowrap >总价(元/含税)</td>\n" +
                                    "                                            <td nowrap >"+(orders[i].unitPrice*orders[i].amount)+"</td>\n" +
                                    "                                        </tr>\n" +
                                    "\n" +
                                    "                                        <tr bgcolor=\"#FFFFFF\">\n" +
                                    "                                            <td nowrap >报价开始时间</td>\n" +
                                    "                                            <td nowrap ><input name=\"\" type=\"date\" value="+orders[i].startDate+"></td>\n" +
                                    "                                            </td>\n" +
                                    "                                            <td nowrap >报价截止时间</td>\n" +
                                    "                                            <td nowrap ><input name=\"\" type=\"date\"  value="+orders[i].endDate+"></td>\n" +
                                    "                                            <td nowrap ></td>\n" +
                                    "                                            <td nowrap ></td>\n" +
                                    "                                            </td>\n" +
                                    "                                        </tr>\n" +
                                    "\n" +
                                    "                                    </table></td></tr>"
                                );
                            }
                        }
                    })
                }else{
                    alert("只能修改未发布的询价书!!!");
                    $("#div2").hide();
                    location.href="/queryandqueto/ask1.html";
                }


            }else if(obj.event === "check"){
                $("#div1").hide();
                $("#div2").hide();
                $("#div3").show();
                $.ajax({
                    url: "/Enquire/findById",
                    data:{
                        "id":id,
                        "enquireNum":enquireNum
                    },
                    type: "POST",
                    success: function (result) {
                        $("#id2").html(result.id);
                        $("#company2").html("长沙北大青鸟有限公司");
                        $("#enquireNum2").html(result.enquireNum);
                        $("#enquireName3").html(result.enquireName);
                        $("#linkman2").html(result.linkman);
                        $("#address2").html(result.address);
                        $("#phone2").html(result.phone);
                        $("#fax2").html(result.fax);
                        $("#zip2").html(result.zip);
                        $("#email2").html(result.email);
                        $("#endDate2").html(result.endDate);
                        $("#endDate3").html(result.endDate);
                        $("#remark2").html(result.remark);
                        var orders=result.stock.orders;
                        for (let i = 0; i < orders.length; i++) {
                            $("#tableEnq2").append(
                                "<tr>\n" +
                                "                                <td>\n" +
                                "                                    <table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\" id=\"datatable\">\n" +
                                "\n" +
                                "                                        <tr class=t2>\n" +
                                "                                            <td >物资编码</td>\n" +
                                "                                            <td >"+orders[i].materialCode+"<br></td>\n" +
                                "                                            <td >物资名称</td>\n" +
                                "                                            <td >"+orders[i].materialName+"<br></td>\n" +
                                "                                            <td ></td>\n" +
                                "                                            <td ></td>\n" +
                                "                                        </tr>\n" +
                                "                                        <tr class=t2>\n" +
                                "                                            <td >计量单位</td>\n" +
                                "                                            <td >"+orders[i].measureUnit+"<br></td>\n" +
                                "                                            <td >交货期</td>\n" +
                                "                                            <td >"+orders[i].startDate+"</td>\n" +
                                "                                            <td ></td>\n" +
                                "                                            <td ></td>\n" +
                                "                                        </tr>\n" +
                                "\n" +
                                "                                        <tr bgcolor=\"#FFFFFF\">\n" +
                                "                                            <td nowrap >计划价(元/不含税)</td>\n" +
                                "                                            <td nowrap >"+orders[i].unitPrice+"</td>\n" +
                                "                                            <td nowrap >数量</td>\n" +
                                "                                            <td nowrap >"+orders[i].amount+"</td>\n" +
                                "                                            <td nowrap >预算总金额(元)</td>\n" +
                                "                                            <td nowrap >"+(orders[i].unitPrice*orders[i].amount)+"</td>\n" +
                                "                                        </tr>\n" +
                                "\n" +
                                "                                        \n" +
                                "\n" +
                                "                                    </table></td></tr>"
                            );
                        }
                    }
                });
            }

        })
        $('#search').on('click', function(){
            table.reload('tableAll', {
                method : 'get',
                /*url:'/contractmanager/byName',//这个不写表示使用table中的请求*/
                where : {
                    enquireName : $.trim($('#enquireName').val()),
                    status : $.trim($('#status').val())
                },
                page : {
                    curr : 1
                }
            });
            return false;
        });
    });
    function updateEnq() {
        var id = $("#id").html();
        var enquireNum=$("#enquireNum").html();
        var enquireName=$("#enquireName2").val();
        var company=$("#company").html();
        var linkman=$("#linkman").val();
        var address=$("#address").val();
        var phone=$("#phone").val();
        var fax=$("#fax").val();
        var zip=$("#zip").val();
        var email=$("#email").val();
        var endDate=$("#endDate").val();
        var remark=$("#remark").val();
        $("#gsi").html(company);
        if( id==null && id=='' ||
            enquireNum==null && enquireNum=='' ||
            enquireName==null && enquireName=='' ||
            company==null && company=='' ||
            linkman==null && linkman==''||
            address==null && address==''||
            phone==null && phone==''||
            fax==null && fax==''||
            zip==null && zip==''||
            email==null && email=='' ||
            endDate==null && endDate==''||
            remark==null && remark==''){
            layer.alert("未填写！");
        }else{
            $.ajax({
                url: "/Enquire/updateEnquire",
                data: {
                    "id": $.trim(id),
                    "enquireNum": $.trim(enquireNum),
                    "enquireName": $.trim(enquireName),
                    "company": $.trim(company),
                    "linkman": $.trim(linkman),
                    "address":$.trim(address),
                    "phone": $.trim(phone),
                    "fax":$.trim(fax),
                    "zip": $.trim(zip),
                    "email":$.trim(email),
                    "endDate": $.trim(endDate),
                    "remark": $.trim(remark)
                },
                type: "post",
                success: function (result) {
                    if ($.trim(result) == "true") {
                        alert("修改成功");
                        location.href="/queryandqueto/ask1.html";
                    }
                }
            });
        }
    }
</script>
<script id="link" type="text/html">
    <a lay-event="check" class="layui-table-link" target="_self">{{ d.enquireName }}</a>
</script>
<script id="link2" type="text/html">
    <a lay-event="check2" class="layui-table-link" target="_self">{{ d.company }}</a>
</script>

</html>